const Controller = require('./baseController')

class SchoolController extends Controller {
  async detail() {
    const ctx = this.ctx
    const param = ctx.request.body
    const resData = await ctx.service.school.detail(param)
    if (resData) {
      this.resSuccess(resData)
    } else {
      this.resError(203)
    }
  }

  async create() {
    const ctx = this.ctx
    const param = ctx.request.body
    const resData = await ctx.service.school.create(param)
    if (resData) {
      this.resSuccess()
    } else {
      this.resError(203)
    }
  }

  async update() {
    const ctx = this.ctx
    const param = ctx.request.body
    const resData = await ctx.service.school.update(param)
    if (resData) {
      this.resSuccess()
    } else {
      this.resError(203)
    }
  }

  async delete() {
    const ctx = this.ctx
    const param = ctx.request.body
    const resData = await ctx.service.school.delete(param)
    if (resData) {
      this.resSuccess()
    } else {
      this.resError(203)
    }
  }

  async select() {
    const ctx = this.ctx
    const param = ctx.request.body
    const resData = await ctx.service.school.select(param)
    if (resData) {
      this.resSuccess(resData)
    } else {
      this.resError(203)
    }
  }
}

module.exports = SchoolController